#include "px_gamemain.h"
#include "../rendersystem/px_rendersystem.h"
#include "px_gamerun.h"
#include "GL/glew.h"
static GameState s_cur_gamestate = PX_GAMESTATE_NONE;
static GameState s_pre_gamestate = PX_GAMESTATE_NONE;

void game_mainloop()
{
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
	switch(s_cur_gamestate)
	{
	case PX_GAMESTATE_NONE:
		break;
	case PX_GAMESTATE_LOAD:
		break;
	case PX_GAMESTATE_INIT:
		break;
	case PX_GAMESTATE_RUN:
		game_run_loop();
		break;
	}

}
static void _exit_gamestate(GameState s)
{
	switch (s)
	{
	case PX_GAMESTATE_NONE:
		break;
	case PX_GAMESTATE_LOAD:
		break;
	case PX_GAMESTATE_INIT:
		break;
	case PX_GAMESTATE_RUN:
		game_run_exit();
		break;
	}
}
static void _init_gamestate(GameState s)
{
	switch (s)
	{
	case PX_GAMESTATE_NONE:
		break;
	case PX_GAMESTATE_LOAD:
		break;
	case PX_GAMESTATE_INIT:
		break;
	case PX_GAMESTATE_RUN:
		game_run_init();
		break;
	}
}
void set_gamestate(GameState s)
{
	s_pre_gamestate = s_cur_gamestate;
	_exit_gamestate(s_pre_gamestate);
	s_cur_gamestate = s;
	_init_gamestate(s_cur_gamestate);
}

GameState get_curgamestate()
{
	return s_cur_gamestate;
}
GameState get_pregamestate()
{
	return s_pre_gamestate;
}
